import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

//引入path模块
import path from 'path'
import { resolve } from 'path'

//引入按需加载模块
import  components from 'unplugin-vue-components/vite';

// https://vitejs.dev/config/
export default defineConfig({
  //设置别名
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    },
  },

  server:{
    proxy:{
      '/api': {
        target: 'http://kumanxuan1.f3322.net:8881/cms',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    }
  },

  plugins: [
    vue(),
    components({dts:true})
  ],
})
